using Jupiter;
using Jupiter.Infrastructure.Permission.DataPermissions;
using System.Reflection;
using System.Text;
using Wips.AppService.SqlSugar;
using Wips.Infrastructure;

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;
Assembly[] assemblies =
[
    typeof(Wips.MainServer.Anchor).Assembly,
    typeof(Wips.AppService.Anchor).Assembly,
    typeof(Wips.AppService.SqlSugar.Anchor).Assembly

];
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
services.AddJupiter<Wips.MainServer.Anchor>(
    configuration,
    assemblies.ToList()
);
services.AddPublishMaster(); // 注册
services.AddSingleton<IDataPermission, BlankPermissions>();
services.AddScoped<PublishMasterService>();
var app = builder.Build();
if (env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
}

app.UseJupiter<Wips.MainServer.Anchor>(configuration, assemblies);
app.UsePublishMaster(); // use 
app.Run();